﻿<Application x:Class="PHPVHGUI.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml">
    <Application.Resources>
        <Style x:Key="WindowStyle" TargetType="Window">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,.5" EndPoint="1,.5">
                        <GradientStop Offset="0" Color="#C087CEFB" />
                        <GradientStop Offset=".8" Color="#DFFFFFFF" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="Label">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontWeight" Value="Bold" />
        </Style>
        <Style TargetType="CheckBox">
            <Setter Property="Margin" Value="6,2,2,2" />
        </Style>
        <Style TargetType="RadioButton">
            <Setter Property="Margin" Value="6,2,2,2" />
        </Style>
        <Style TargetType="Button" x:Key="ButtonStyle">
            <Setter Property="Margin" Value="4" />
            <Setter Property="Width" Value="90" />
            <Setter Property="Height" Value="30" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="ButtonRoot">
                            <Rectangle RadiusX="4" RadiusY="4" Stroke="DarkGray" Fill="DarkBlue" />
                            <Rectangle Fill="LightBlue" RadiusX="3" RadiusY="3" Margin="2"/>
                            <Rectangle Opacity=".75" RadiusX="4" RadiusY="4">
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <GradientStop Offset="0" Color="#C0FFFFFF" />
                                        <GradientStop Offset=".5" Color="#DFFFFFFF" />
                                        <GradientStop Offset=".5" Color="#60FEFEFE" />
                                        <GradientStop Offset="1" Color="#DFFFFFFF" />
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <ContentPresenter HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              RecognizesAccessKey="True"/>
                            <Rectangle x:Name="OverlayRectangle" Fill="Blue"
                                       Opacity=".1" Visibility="Hidden" />
                            <Rectangle x:Name="DisabledRectangle" Fill="LightGray"
                                       Opacity=".65" Visibility="Hidden" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="ButtonRoot" Property="Margin"
                                        Value="1,1,-1,-1" />
                                <Setter TargetName="OverlayRectangle"
                                        Property="Visibility"
                                        Value="Visible" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="DisabledRectangle"
                                        Property="Visibility"
                                        Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}" />
        <Style TargetType="TextBox">
            <Setter Property="Height" Value="26" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border BorderBrush="#FFAFAFAF" BorderThickness="1">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="White" />
                                    <Style.Triggers>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="Background" Value="#FFDFDFDF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <Grid>
                                <!--<Rectangle Fill="#FFAFAFAF" Opacity=".5" />-->
                                <ScrollViewer x:Name="PART_ContentHost" />
                            </Grid>                            
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="#FF4F4F4F"/>                    
                </Trigger>
                <Trigger Property="IsReadOnly" Value="True">
                    <!--<Setter Property="Foreground" Value="#FF6F6F6F"/>-->
                    <Setter Property="Foreground" Value="#FF4F4F4F"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="TextBox" x:Key="ReadOnlyTextBox">
            <Setter Property="Height" Value="26" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border BorderBrush="#FFAFAFAF" BorderThickness="1">
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Background" Value="Transparent" />
                                    <Style.Triggers>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="Background" Value="#FFDFDFDF"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <Grid>
                                <!--<Rectangle Fill="#FFAFAFAF" Opacity=".5" />-->
                                <ScrollViewer x:Name="PART_ContentHost" />
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="#FF4F4F4F"/>
                </Trigger>
                <Trigger Property="IsReadOnly" Value="True">
                    <!--<Setter Property="Foreground" Value="#FF6F6F6F"/>-->
                    <Setter Property="Foreground" Value="#FF4F4F4F"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="BorderStyle" TargetType="Border">
            <Setter Property="Margin" Value="2" />
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Offset="0" Color="#C0FFFFFF" />
                        <GradientStop Offset=".4" Color="#DFFFFFFF" />
                        <GradientStop Offset=".7" Color="#60E6E6E6" />
                        <GradientStop Offset="1" Color="#DFFFFFFF" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderThickness" Value="3" />
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0.25,0.05" EndPoint="0.25,1">
                        <GradientStop Offset="0" Color="#FFDEDEDE" />
                        <GradientStop Offset=".4" Color="#FDFDFDFD" />
                        <GradientStop Offset=".7" Color="#FFFFFFFF" />
                        <GradientStop Offset=".9" Color="#FDEEEEEE" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="TabControl">
            <Setter Property="Margin" Value="2" />
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Offset="0" Color="#C0FFFFFF" />
                        <GradientStop Offset=".4" Color="#DFFFFFFF" />
                        <GradientStop Offset=".7" Color="#60E6E6E6" />
                        <GradientStop Offset="1" Color="#DFFFFFFF" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderThickness" Value="3" />
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0.25,0.05" EndPoint="0.25,1">
                        <GradientStop Offset="0" Color="#FFDEDEDE" />
                        <GradientStop Offset=".4" Color="#FDFDFDFD" />
                        <GradientStop Offset=".7" Color="#FFFFFFFF" />
                        <GradientStop Offset=".9" Color="#FDEEEEEE" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>      
        <Style TargetType="TabItem">
            <Setter Property="FontFamily" Value="Arial" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TabItem">
                        <Grid x:Name="TabItemRoot" Margin="0,0,4,4">
                            <Rectangle x:Name="BackgroundRectangle">
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <GradientStop Offset="0" Color="#C0FFFFFF" />
                                        <GradientStop Offset=".5" Color="#DFFFFFFF" />
                                        <GradientStop Offset=".5" Color="#60FEFEFE" />
                                        <GradientStop Offset="1" Color="#DFFFFFFF" />
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Rectangle x:Name="OverlayRectangle" Fill="LightBlue"
                                       Opacity=".25" Visibility="Collapsed" />
                            <ContentPresenter Margin="4" HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              ContentSource="Header" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="BackgroundRectangle" Property="Stroke">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint=".4,0" EndPoint=".6,1">
                                            <GradientStop Color="#FF55AAFF" Offset="0" />
                                            <GradientStop Color="#FF0066FF" Offset=".1" />
                                            <GradientStop Color="#FF5599FF" Offset=".5" />
                                            <GradientStop Color="#FF55AAFF" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <!--<Setter TargetName="TabItemRoot" Property="Margin"
                                        Value="0" />-->
                                <Setter TargetName="OverlayRectangle" Property="Visibility"
                                        Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="HeaderTextStyle" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Margin" Value="-1,4,0,0" />
            <Setter Property="VerticalAlignment" Value="Bottom" />
        </Style>

        <Style x:Key="ValidatedButtonStyle" TargetType="Button" BasedOn="{StaticResource ButtonStyle}">
            <Setter Property="IsEnabled" Value="false" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding 
                                            ElementName=PortTextBox,
                                            Path=(Validation.HasError)}"
                                               Value="false"/>
                        <Condition Binding="{Binding 
                                            ElementName=TimeoutTextBox,
                                            Path=(Validation.HasError)}"
                                               Value="false"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="IsEnabled" Value="true" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

    </Application.Resources>
</Application>
